const path = require('path');

var myPath = path.resolve('path1','path2', 'path3.js');

console.log(myPath);

var obj = path.parse(myPath);

console.log(obj);